unit LoginForm;

interface

uses
  Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, uADStanIntf,
  uADStanOption, uADStanError, uADGUIxIntf, uADPhysIntf, uADStanDef,
  uADStanPool, uADStanAsync, uADPhysManager, uADStanParam, uADDatSManager,
  uADDAptIntf, uADDAptManager, Data.DB, uADCompDataSet, uADCompClient,
  IWCompButton, IWCompEdit, Vcl.Controls, IWVCLBaseControl, IWBaseControl,
  IWBaseHTMLControl, IWControl, IWCompLabel, uADGUIxFormsWait, uADPhysMySQL,
  uADCompGUIx;

type
  TIWfmLogin = class(TIWAppForm)
    IWLabel1: TIWLabel;
    IWLabel2: TIWLabel;
    txtUsername: TIWEdit;
    txtPassword: TIWEdit;
    btnLogin: TIWButton;
    btnClear: TIWButton;
    ADConnection1: TADConnection;
    ADQuery1: TADQuery;
    ADGUIxWaitCursor1: TADGUIxWaitCursor;
    ADPhysMySQLDriverLink1: TADPhysMySQLDriverLink;
    procedure btnLoginClick(Sender: TObject);
    procedure btnClearClick(Sender: TObject);
    procedure IWAppFormCreate(Sender: TObject);
  public
  end;

implementation

uses
  MainForm;

{$R *.dfm}


procedure TIWfmLogin.btnClearClick(Sender: TObject);
begin
  txtUsername.Text := '';
  txtPassword.Text := '';
end;

procedure TIWfmLogin.btnLoginClick(Sender: TObject);
begin
  ADQuery1.Active := False;
  ADQuery1.Params.ParamByName('Username').AsString := txtUsername.Text;
  ADQuery1.Params.ParamByName('Password').AsString := txtPassword.Text;
  ADQuery1.Active := True;
  if ADQuery1.RowsAffected > 0 then
//    WebApplication.ShowMessage('Logged in!');
    TIWAppForm(WebApplication.Forms[0]).Show;
end;

procedure TIWfmLogin.IWAppFormCreate(Sender: TObject);
begin
  txtUsername.SetFocus;
end;

end.
